<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>controlP5 : : Textlabel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
		<div id="header">
		<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
		</div>
	<div class="content">
		<h1>Textlabel</h1>
		<dl><dt class="key">description</dt><dd class="value">a textlabel is a one-line-text for labeling things or leaving notes.</dd></dl>
			
			<div class="toggleList example">
				<dl><dt onclick="toggle(this)"><span>+</span>Example</dt>
					<dd><pre>import controlP5.*;

ControlP5 controlP5;

Textlabel myBigTextlabel;
Textlabel mySmallTextlabel;
boolean isDrawLabel = true;

void setup() {
  size(400,400);
  frameRate(30);
  controlP5 = new ControlP5(this);

  mySmallTextlabel = controlP5.addTextlabel("label","A SINGLE TESTLABEL.",20,134);
  mySmallTextlabel.setColorValue(0xffcccccc);
  
  myBigTextlabel = new Textlabel(this,"a single textlabel.",20,20,400,200,0xff999999,ControlP5.synt24);
  myBigTextlabel.setLetterSpacing(2);
  myBigTextlabel.setWidth(width);
}



void draw() {
  background(0);
  if(keyPressed && key==' ') {
    // change the display area of a textlabel.
    myBigTextlabel.setWidth(mouseX);
    myBigTextlabel.setHeight(mouseY);
  }
  if(isDrawLabel) {
    myBigTextlabel.draw(this); 
  }
}


void keyPressed() {
  if(key=='t') {
    if(isDrawLabel) {
      println("adding myBigTextlabel to the drawable list of tab 'default'.\n"+
      "myBigTextlabel.draw(this); in draw() is not required anymore.");
      controlP5.tab("default").addDrawable(myBigTextlabel);
      isDrawLabel = false;
    }
  }
}

</pre></dd>
				</dl>
			</div>
			
			
			
			<dl><dt class="key">constructors</dt><dd class="value"><pre>Textlabel(theComponent, theValue, theX, theY, theW, theH, theColor, theFont);
Textlabel(theComponent, theValue, theX, theY);
</pre></dd></dl>
			
			
			
			
   <dl><dt class="key">parameters</dt><dd class="value"><span class="parameters">theComponent</span><span class="parameters">PApplet</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theValue</span><span class="parameters">String</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theX</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theY</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theW</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theH</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theColor</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
<dd class="value"><span class="parameters">theFont</span><span class="parameters">int</span><span class="clear">&nbsp;</span></dd>
</dl>
			
			
			
			<!-- METHODS:BEGIN -->
			
       <dl class="noborder"><dt>Methods</dt></dl>
       <dl><dt class="key"><a href="textlabel_method_draw.htm">draw ( )</a></dt><dd class="value">draw the textlabel.</dd></dl>
<dl><dt class="key"><a href="textlabel_method_setfont.htm">setFont ( )</a></dt><dd class="value">set the Pixel-Fontstyle of the Textlabel.
 see BitFontRenderer for available pixelfonts.</dd></dl>
<dl><dt class="key"><a href="textlabel_method_setletterspacing.htm">setLetterSpacing ( )</a></dt><dd class="value">set the letter spacing of the font.</dd></dl>
<dl><dt class="key"><a href="textlabel_method_setposition.htm">setPosition ( )</a></dt><dd class="value">set the position of the textlabel.</dd></dl>
<dl><dt class="key"><a href="textlabel_method_setvalue.htm">setValue ( )</a></dt><dd class="value">set the text of the textlabel.</dd></dl>

   
			<!-- METHODS:END -->
			<div class="separator">
			<dl><dt class="key">usage</dt><dd class="value">Web & Application</dd></dl>
			</div>
			<div class="separator">
			<dl><dt class="key">related</dt><dd class="value"><ul><li><a href="controller_class_controller.htm">Controller</a></li>
<li><a href="textarea_class_textarea.htm">Textarea</a></li>
</ul></dd></dl>
			</div>
	</div>
	<div id="footer">
	<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
	</div>
</div>
</body>
</html>


